<template>
  <div>
    <cart :cart="cartList" :title="title" @info="getInfo"></cart>
  </div>
</template>

<script>
import cart from '@/components/Cart'

export default {
  name: "mock模拟数据",
  components: {
    cart
  },
  data() {
    return {
      cartList: [],
      title: '购物车',
    }
  },
  async created() {
    try {
      const res = await this.$http.get('/api/cartList')
      console.log(res)
      this.cartList = res.data.result
    } catch (error) {
      console.log(error)
    }
  },
  methods: {
    getInfo(info) {
      console.log('子组件传的值是:', info)
      alert('子组件传的值是:' + info)
    }
  }
}
</script>

<style scoped>

</style>
